$(document).ready(function() {	
			var url = location.search;
					$.ajax({
						type: "post",
						url: "/photo/picDetails.do"+url,
						dataType: "json",
						success: function(data) {
							var watermarkPic = "<ul>";
							var thumbnailPic = "<ul>";
							$.each(data, function(i, n) {
								$('#writerId').text(n["photoWriterId"]);
								$('#writerId').attr("href","/photo/user_pic.html");
								$('#greatCount1').text(n["photoPicGreatCount"]);
								$('#q2').val(n.photoPicTitle);
								$('#q3').val(n.photoPicCost);
								if (i==0) {
									thumbnailPic+= " <li class='on'><img src="+n["photoThumbnailPicPath"]+ " width='50' height='50'><div class='bun_bg'></div>"
								} else {
									thumbnailPic+= " <li class=''><img src="+n["photoThumbnailPicPath"]+ " width='50' height='50'><div class='bun_bg'></div>"
									watermarkPic+="<li><img src="+n["photoWatermarkPicPath"]+"></li>";
								}
							});
							watermarkPic += "</ul>";
							thumbnailPic += "</ul>";
							$('#thumbnailPic').append(thumbnailPic);
							$('#watermarkPic').append(watermarkPic);
							
							
						}
					});
					$.ajax({
						type: "post",
						url: "/photo/order.do"+url,
						dataType: "json",
						success: function(data) {
							if (data>0) {
								$("#original").text("查看原图");
								$("#original").attr("href","/photo/pic-original.html"+url);
								$("#original").attr("data-toggle","#");
								$("#original").attr("data-target","#");
							}							
						}
					});
					
			});
				function great(){
					var url = location.search;
					var span = $("#greatCount").children(":first");
					if(span[0].text=="点赞"){
						span.text("取消赞");
						$.ajax({
							type: "post",
							url: "/photo/picGreat.do"+url,
							dataType: "json"
						});
					}else{
						span.text("点赞");
						$.ajax({
							type: "post",
							url: "/photo/picRemoveGreat.do"+url,
							dataType: "json"
						});
					}
	
}
				function fav(){
					var url = location.search;
					var span = $("#greatCount").children().eq(1);
					if(span[0].text=="收藏作品"){
						span.text("取消收藏");
						$.ajax({
							type: "post",
							url: "/photo/fav.do"+url,
							dataType: "json"
						});
					}else{
						span.text("收藏作品");
						$.ajax({
							type: "post",
							url: "/photo/removeFav.do"+url,
							dataType: "json"
						});
					}
}	
				
				
